package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	//resp, err := http.Get("http://www.baidu.com")
	//if err != nil {
	//	fmt.Println(err.Error())
	//	return
	//}
	//
	//defer resp.Body.Close()
	//body, err := ioutil.ReadAll(resp.Body)
	//if err != nil {
	//	fmt.Println(err.Error())
	//	return
	//}
	//
	//fmt.Println(string(body))

	client := &http.Client{}
	request, _ := http.NewRequest("GET", "http://www.httpbin.org/headers", nil)
	request.Header.Set("Cache-Control", "max-age=10")
	request.Header.Set("Connection", "keep-alive")
	request.Header["x-b3-traceid"] = []string{"[24c52c4657fca1df14b74a56bb2396aa]"}

	response, _ := client.Do(request)
	if response.StatusCode == 200 {
		body, _ := ioutil.ReadAll(response.Body)
		bodystr := string(body)
		fmt.Println(bodystr)
	}
}
